# list=['name','credentialsNumber','sex','age','workLength','educationId','graduatedSchool','profession','position','companyId','certificateTypeId','positionalTitleProfession','registrationProfession','issuingAuthority','issuingDateStart','issuingDateEnd','periodDateStart','periodDateEnd','practitionerType']
# a="""if (request.getParameter("{name}") != null&&request.getParameter("{name}") != "") _{_
# 			map.put("{name}", request.getParameter("{name}"));
# 		_}_"""
# for i in list:
#     b = a.replace("_{_", "_1").replace("_}_", "_2")
#     c = b.format(name=i)
#     d = c.replace("_1", "{").replace("_2", "}")
#     print(d)

def to_low_camel_case(str):
    str = str.replace(" ", "")
    list = str.split("_")
    first = list[0].lower()
    others = list[1:]
    others_cap = [word.capitalize() for word in others]
    others_cap[0:0] = [first]
    return ''.join(others_cap)


def to_cap_camel_case(str):
    str = str.replace(" ", "")
    list = str.split("_")
    result = [word.capitalize() for word in list]
    return ''.join(result)


list = ['name', 'credentialsNumber', 'sex', 'age', 'workLength', 'educationId', 'graduatedSchool', 'profession',
        'position', 'companyId', 'certificateTypeId', 'positionalTitleProfession', 'registrationProfession',
        'issuingAuthority', 'issuingDateStart', 'issuingDateEnd', 'periodDateStart', 'periodDateEnd',
        'practitionerType']
a = """if (request.getParameter("{name}") != null&&request.getParameter("{name}") != "") _{_
			map.put("{name}", request.getParameter("{name}"));
		_}_"""
for i in list:
    b = a.replace("_{_", "_1").replace("_}_", "_2")
    c = b.format(name=i)
    d = c.replace("_1", "{").replace("_2", "}")
    print(d)
